/*
 * ComponenteDao.java
 *
 * Created on August 12, 2007, 11:43 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package tcc.dao.produto;

import java.io.Serializable;
import java.lang.StringBuilder;
import java.util.List;
import tcc.dao.AbstractDao;
import tcc.dao.Criteria;
import tcc.exception.business.TccBusinessException;
import tcc.exception.system.TccDAOException;
import tcc.util.PersistenceUtil;
import tcc.domain.produto.Componente;
import javax.persistence.Query;
import javax.persistence.EntityExistsException;
import tcc.exception.business.ComponenteCadatradoException;

/**
 *
 * @author Diego
 */
public class ComponenteDao extends AbstractDao{
    
    /** Creates a new instance of ComponenteDao */
    public ComponenteDao() {
    }
    
    
    public List<Componente> findComponentes(Criteria c){
        
        return super.find(Componente.class,c);
    }
    
    public List<Componente> findAll(){
        return this.findComponentes(null);
    }

    
    public Componente findById( Serializable id) {
        return super.findById(Componente.class, id);
    }
    
    public void save(Componente c) throws TccDAOException, TccBusinessException {
        try {
            super.save(c);
        }catch(RuntimeException ex){
            throw new TccBusinessException(ex);
        }catch (Exception ex){
            throw new TccDAOException(ex);
        }
    }
    
    public void delete(Componente c) throws TccDAOException, TccBusinessException {
        try {
            super.delete(c);
        }catch(RuntimeException ex){
            throw new TccBusinessException(ex);
        }catch (Exception ex){
            throw new TccDAOException(ex);
        }
    }
    
}
